let nodemailer = require("nodemailer");
let transporter = nodemailer.createTransport({
    service: "outlook",
    auth: {
        user: "hughoo@outlook.com",
        pass: "pply419zz!"
    }
});

let message = {
    from: '"Hugo Hoo" <hughoo@outlook.com>',
    to: "hughoo@outlook.com",
    subject: "Send HTML",
    text: "HTML测试",
    html: {
        path: "./main.html"
    },
    attachments: [
        {
            path: "test.jpg",
            cid: "img01"
        }
    ]
};

transporter.sendMail(message, function(error, info){
    if(error){
        console.log(error);
    }else{
        console.log('Message sent: ' + info.response);
    }
});